home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Matrix / MyObject.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  78 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "MyObject.h"
  5. #import "VarMatrix.h"
  6. #import <appkit/Form.h>
  7. #import <appkit/TextFieldCell.h>
  8.  
  9. @implementation MyObject
  10.  
  11. -init
  12. {
  13.     
  14.     NXRect              frameRect = {0.0, 0.0, 0.0, 0.0};
  15.     id                  cellPrototype;
  16.     NXSize              size;
  17.  
  18.     cellPrototype = [[TextFieldCell alloc] initTextCell:"kkkkkk"];
  19.     [cellPrototype setTextGray:NX_BLACK];
  20.     [cellPrototype setBordered:YES];
  21.     [cellPrototype setEditable:YES];
  22.     matrix = [[VarMatrix alloc] initFrame:&frameRect mode:NX_TRACKMODE
  23.               prototype:cellPrototype numRows:0 numCols:0];
  24.     size.width = 0.0;
  25.     size.height = 0.0;
  26.     [matrix setIntercell:&size];
  27.     
  28.     [matrix renewRows:10 cols:4];
  29.     [matrix sizeToCells];
  30.     [matrix update];
  31.     return self;
  32.  
  33. }
  34. -appDidInit:sender
  35. {
  36.     [[window contentView] addSubview:matrix];
  37.     [matrix display];
  38.     [matrix setTextDelegate:self];
  39.     [window flushWindow];
  40.     [window orderFront:self];
  41.     return self;
  42. }
  43. -zz:sender
  44. {
  45.     [matrix erase];
  46.     [matrix setWidth:[sender floatValue] forCol:1];
  47.     return self;
  48. }
  49. -ww:sender
  50. {
  51.     [matrix setHeight:[sender floatValue] forRow:6];
  52.     return self;
  53. }
  54. -do:sender
  55. {
  56.     [matrix erase];
  57.     [matrix setWidth:[form floatValueAt:1] forCol:[form intValueAt:0]];
  58.     [matrix setHeight:[form floatValueAt:3] forRow:[form intValueAt:2]];
  59.     
  60.     [matrix sizeToCells];
  61.     [matrix update];
  62.     return self;
  63.     
  64. }
  65. /**** DELEGATE METHOD FOR TEXT OBJECT ******/
  66. -textDidEnd:textObject endChar:(unsigned short)whyEnd
  67. {
  68.     int        row,col;
  69.                     
  70.     row = [matrix selectedRow];
  71.     col = [matrix selectedCol];
  72.         
  73.     printf("value = %f\n",[[matrix selectedCell] floatValue]);
  74.     return self;
  75. }
  76.  
  77. @end
  78.